<?php

use App\Models\ConfigApp;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateConfigAppsTable extends Migration
{
    public function up()
    {
        Schema::create('config_apps', function (Blueprint $table) {
            $table->id();
	        $table->string('name')->nullable()->comment('name of mobile app');
	        $table->string('logo')->nullable();
	        $table->string('bg_image')->nullable();

	        // For payment.
	        $table->string('mini_appid')->nullable();
	        $table->string('mini_pay_mark')->nullable();

	        $table->boolean('is_ios_on')->default(false);
	        $table->string('pending_ios_version')->nullable();
	        $table->string('ios_url')->nullable();
	        $table->string('android_url')->nullable();
	        $table->integer('downloads_android')->nullable()->default(0)->comment('how many times downloading android app');
	        $table->integer('downloads_ios')->nullable()->default(0)->comment('how many times downloading ios app');
	        $table->string('version')->nullable()->default('1.0.1');
	        $table->string('version_ios')->nullable()->default('1.0.1');
        });

        ConfigApp::create(['name' => 'RichThings']);
    }

    public function down()
    {
        Schema::dropIfExists('config_apps');
    }
}
